package com.freewater.springboot.demo.validation.baseuse;

import lombok.Data;

import jakarta.validation.Valid;
import jakarta.validation.constraints.*;
import java.util.List;

@Data
public class User {

    @NotBlank(message = "用户名不能为空")
    private String userName;

    @NotBlank(message = "密码不能为空")
    @Size(min = 6, max = 16)
    private String password;

    @Min(1)
    @Max(120)
    private Integer age;

    @Email(regexp = "^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\\.[a-zA-Z0-9-]+)*\\.[a-zA-Z0-9]{2,6}$", message = "邮件格式错误")
    private String email;

    @Size(min = 11, max = 11)
    private String mobile;

    //是否VIP 0否 1是 空默认否
    private Integer vipFlag;

    //VIP授权码 vipFlag为是必填
    private String vipLicenseKey;

    //学习科目
    @NotEmpty(message = "用户学习科目不能为空")
    @Valid
    @ListGt(3)
    List<Subject> subjectList;
}
